import VueRouter from 'vue-router'
import Vue from 'vue'

// import MSite from '../pages/MSite/MSite.vue'
// import Order from '../pages/Order/Order.vue'
// import Search from '../pages/Search/Search.vue'
// import Profile from '../pages/Profile/Profile.vue'


// 组件的懒加载
const MSite = () => import('../pages/MSite/MSite.vue');
const Order = () => import('../pages/Order/Order.vue');
const Search = () => import('../pages/Search/Search.vue');
const Profile = () => import('../pages/Profile/Profile.vue');

import Login from '../pages/Login/login.vue'
import Shop from '../pages/Shop/shop.vue'
import ShopGoods from '../pages/Shop/ShopGoods/ShopGoods.vue'
import ShopRatings from '../pages/Shop/ShopRatings/ShopRatings.vue'
import ShopInfo from '../pages/Shop/ShopInfo/ShopInfo.vue'

Vue.use(VueRouter);

export default new VueRouter({
  routes: [
    { path: '/', redirect: '/msite' },
    { path: '/msite', component: MSite },
    { path: '/order', component: Order },
    { path: '/search', component: Search },
    { path: '/profile', component: Profile },
    { 
      path: '/login', 
      component: Login,
      meta: {
        hiddenFooter: true
      }
    },
    { 
      path: '/shop', 
      component: Shop,
      
      children: [
        { path: '/shop/goods', component: ShopGoods, meta: { hiddenFooter: true} },
        { path: '/shop/ratings', component: ShopRatings, meta: { hiddenFooter: true} },
        { path: '/shop/info', component: ShopInfo, meta: { hiddenFooter: true} },
        { path: '', redirect: '/shop/goods', meta: { hiddenFooter: true} },
      ]
    }
  ],
  linkActiveClass: 'on'
})